import React, { Component } from "react";
import { connect } from "react-redux";
import { addCount, minusCount } from "../store/actions";

class ReduxDemo01 extends Component {
  add = () => {
    this.props.addCount(1);
  };
  minus = () => {
    this.props.minusCount(1);
  };
  render() {
    const { count } = this.props;
    return (
      <div>
        <div>{count}</div>
        <button onClick={this.add}>+</button>
        <button onClick={this.minus}>-</button>
      </div>
    );
  }
}
export default connect(state => ({ count: state.count }), {
  addCount,
  minusCount
})(ReduxDemo01);
